﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using SevenInvaders.common;

namespace SevenInvaders.LEVEL_CAIOZ
{
    class CaioPlayer : Player
    {
        #region Atributos

        int player;

        Texture2D textureShoot;

        SoundEffect soundEffect;

        private Texture2D texture2D;
        private Vector2 vector2;
        private int p;
        private Texture2D texture;
        private ContentManager Content;
        # endregion

        public CaioPlayer(Texture2D texture, Vector2 position, int player, GameWindow gameWindow, ContentManager Content)
            : base(texture, position, player, gameWindow, Content)
        {
            this.Position = position;
            this.player = player;
            this.Velocity = new Vector2(50, 0);
            this.Window = gameWindow;
        }
        public void Update(GameTime gameTime, KeyboardState teclado, KeyboardState teclado_anterior)
        {
            #region Movimentação
            if (teclado.IsKeyDown(Keys.Right))
            {
                this.PositionX += 10;
            }

            if (teclado.IsKeyDown(Keys.Left))
            {
                this.PositionX -= 10;
            }

            if (teclado.IsKeyDown(Keys.Up))
            {
                this.PositionY -= 10;
            }

            if (teclado.IsKeyDown(Keys.Down))
            {
                this.PositionY += 10;
            }
            #endregion

            if (teclado.IsKeyDown(Keys.Space) && !teclado_anterior.IsKeyDown(Keys.Space))
            {
                //Shoot.list.Add(new Shoot(Game1.jonathantiro, this.Position, Shoot.Direction.UP, this.Velocity));
            }

            #region Limite de tela
            if (this.PositionX + this.Texture.Bounds.Width > Window.ClientBounds.Width)
            {
                this.PositionX = Window.ClientBounds.Width - this.Texture.Bounds.Width;
            }

            if (this.PositionX <= 0)
            {
                this.PositionX = 0;
            }

            if (this.PositionY + this.Texture.Bounds.Height > Window.ClientBounds.Height)
            {
                this.PositionY = Window.ClientBounds.Height - this.Texture.Bounds.Height;
            }

            if (this.PositionY <= 0)
            {
                this.PositionY = 0;
            }
            #endregion
        }
    }
}
